package br.unb.cic.wizard;

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;

public class Wizard {

	private JFrame Janela1 = null;
	private JFrame Janela2 = null;
	private JPanel jContentPane1 = null;
	private JPanel jContentPane2 = null;
	private JTextArea TF_CodigoFonte = null;
	private JLabel LB_CodigoFonte = null;
	private JPanel JP_Botoes = null;
	private JButton BT_Proximo = null;
	private JButton BT_Anterior = null;
	@SuppressWarnings("unused")
	private int Janela = 0;

	/**
	 * This method initializes jFrame
	 * 
	 * @return javax.swing.JFrame
	 */
	private JFrame getJanela1() {
		if (Janela1 == null) {
			Janela = 1;
			Janela1 = new JFrame();
			Janela1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			Janela1.setSize(640, 480);
			Janela1.setContentPane(getJContentPane1());
			Janela1.setTitle("Algostep Wizard");
		}
		return Janela1;
	}
	
	/**
	 * This method initializes jFrame
	 * 
	 * @return javax.swing.JFrame
	 */
	private JFrame getJanela2() {
		if (Janela2 == null) {
			Janela = 2;
			Janela2 = new JFrame();
			Janela2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			Janela2.setSize(640, 480);
			Janela2.setContentPane(getJContentPane2());
			Janela2.setTitle("Algostep Wizard");
		}
		return Janela1;
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane1() {
		if (jContentPane1 == null) {
			BorderLayout borderLayout = new BorderLayout();
			borderLayout.setHgap(10);
			borderLayout.setVgap(5);
			LB_CodigoFonte = new JLabel();
			LB_CodigoFonte.setText("Digite o codigo fonte do programa:");
			jContentPane1 = new JPanel();
			jContentPane1.setLayout(borderLayout);
			jContentPane1.add(getTF_CodigoFonte(), BorderLayout.CENTER);
			jContentPane1.add(LB_CodigoFonte, BorderLayout.NORTH);
			jContentPane1.add(getJP_Botoes(), BorderLayout.SOUTH);			
		}
		return jContentPane1;
	}
	
	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane2() {
		if (jContentPane2 == null) {
			BorderLayout borderLayout = new BorderLayout();
			borderLayout.setHgap(10);
			borderLayout.setVgap(5);
			LB_CodigoFonte = new JLabel();
			LB_CodigoFonte.setText("Digite o codigo fonte do programa:");
			jContentPane2 = new JPanel();
			jContentPane2.setLayout(borderLayout);
			jContentPane2.add(getTF_CodigoFonte(), BorderLayout.CENTER);
			jContentPane2.add(LB_CodigoFonte, BorderLayout.NORTH);
			jContentPane2.add(getJP_Botoes(), BorderLayout.SOUTH);			
		}
		return jContentPane2;
	}

	/**
	 * This method initializes TF_CodigoFonte	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextArea getTF_CodigoFonte() {
		if (TF_CodigoFonte == null) {
			TF_CodigoFonte = new JTextArea();
		}
		return TF_CodigoFonte;
	}

	/**
	 * This method initializes JP_Botoes	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJP_Botoes() {
		if (JP_Botoes == null) {
			JP_Botoes = new JPanel();
			JP_Botoes.setLayout(new BorderLayout());
			JP_Botoes.setSize(100,100);
			JP_Botoes.add(getBT_Proximo(), BorderLayout.EAST);
			JP_Botoes.add(getBT_Anterior(), BorderLayout.WEST);
		}
		return JP_Botoes;
	}

	/**
	 * This method initializes BT_Proximo	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBT_Proximo() {
		if (BT_Proximo == null) {
			BT_Proximo = new JButton();
			BT_Proximo.setText("Proximo");
			BT_Proximo.addMouseListener(new java.awt.event.MouseAdapter() {
				public void mouseClicked(java.awt.event.MouseEvent e) {
					getJanela1().dispose();
					getJanela2().setVisible(true);
					//Continuar daqui...
					
				}
			});
		}
		return BT_Proximo;
	}

	/**
	 * This method initializes BT_Anterior	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBT_Anterior() {
		if (BT_Anterior == null) {
			BT_Anterior = new JButton();
			BT_Anterior.setEnabled(false);
			BT_Anterior.setText("Anterior");
		}
		return BT_Anterior;
	}

	/**
	 * Launches this application
	 */
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				Wizard application = new Wizard();
				application.getJanela1().setVisible(true);
				
			}
		});
	}

}
